#include <linux/fs.h>
#include "ntfs_kernel.h"

static void ntfs_put_super(struct super_block *sb) {
    /* 同步元数据 */
    sync_blockdev(sb->s_bdev);
}

static int ntfs_statfs(struct dentry *dentry, struct kstatfs *buf) {
    struct super_block *sb = dentry->d_sb;
    struct ntfs_volume *vol = NTFS_SB(sb)->vol;

    buf->f_type = NTFS_SUPER_MAGIC;
    buf->f_bsize = vol->cluster_size;
    buf->f_blocks = vol->nr_clusters;
    buf->f_bfree = vol->free_clusters;
    buf->f_bavail = vol->free_clusters;
    return 0;
}

static struct super_operations ntfs_super_ops = {
    .put_super    = ntfs_put_super,
    .statfs       = ntfs_statfs,
};
